package com.neuedu.guide;

public class MyVariable {


    /**
     * main  自动补全
     * @param args
     */
    public static void main(String[] args) {

        //数据的计算


        /**
         * 数据类型
         *
         *    基础类型：
         *      4 类   8 种
         *          整数数字
         *              byte  short int long
         *
         *          浮点型
         *               float   double
         *          布尔类型
         *              boolean
         *          字符
         *              char
         *
         *    引用类型
         */
        //定义变量
//        数据类型  变量名名称 = 初始的值;

        byte bnum = 25;
        short snum = 200;
        //整形默认是 int
        int age = 100;
        long lnum = 500;


// 浮点型
        float pi = 3.1415926f;
        //浮点型数字 默认是  double
        double dnum = 3.1415926;

        //字符
        char c1 = 'a';
        char c2 = 'b';
        char c3 = 'c';
        char c4 = 'd';
        char c5 = 'e';
        //特殊字符，不能通过键盘直接敲     newline   \n  转义字符
        char c6 = '\n';    // \r return    \n  newLine         \t   Tab

        //使用Unicode编码

        char c7 = '\u03A6';
        char c8 = '华';

        System.out.println("我是:\r\n金山老师");


//        布尔类型 表示真和假     true    false
        boolean b1 = true;
        boolean b2 = false;




        int numa = 100;
        System.out.println("numa "+numa);

        numa = 200;
        System.out.println("numa "+numa);



        int numb = numa;
        System.out.println("numb = " + numb);
        numa = 300;
        System.out.println("numb = " + numb);



        //类型转换

        byte btnuma = 15;

        int numc = btnuma;

        long lnum2 = 999;


        //大类型向小类型赋值有风险 ,需要强制 手动转换
        numc = (int)lnum2;
        btnuma = (byte) lnum2;

        System.out.println("numc = " + numc);
        System.out.println("btnuma = " + btnuma);


        //  97---122  a-z
        // 65    90  A -Z
        int num97 = 122;
        char charFromInt = (char) num97;

        System.out.println("charFromInt = " + charFromInt);
    }


}
